let sy = Symbol('kk')
//正确写法
let syObject = {
    [sy]:'abc',
    test:'test'
}
let syObject1 = {}
syObject1[sy] = 'abc'
console.log(sy,'sy')  //Symbol(kk)
console.log(syObject,'syObject')
console.log(syObject1,'syObject16666')

//错误写法
let syObject2 = {
    sy:'abc'
}

//取值(正确写法)
console.log(syObject2[sy])
//取值(错误写法)
console.log(syObject2.sy)

//不能通过for...in、for...of、Object.keys()、Object.getOwnPropertyNames()返回
console.log(Object.keys(syObject))
console.log(Object.getOwnPropertyNames(syObject))

//只能通过Object.getOwnPropertySymbols()、Reflect.ownKeys()取到
//Object.getOwnPropertySymbols()只能取到Symbol定义的属性，其他属性取不到
//Reflect.ownKeys()，该对象的全部属性（包括Symbol定义和普通定义）
console.log(Object.getOwnPropertySymbols(syObject)) //[Symbol(kk)]
console.log(Reflect.ownKeys(syObject)) //['test',Symbol(kk)]


//即使Symbol的描述符是一致的，symbol2也是不等于symbol1
let symbol1 = Symbol('id')
let symbol2 = Symbol('id')
let object = {
    [symbol1]:'30',
    [symbol2]:'30'
}
console.log(object,'object')
console.log(object[symbol1],'object')
console.log(object[symbol2],'object')
console.log(Boolean(symbol2))  //true
console.log(String(symbol2))  //'Symbol(id)'
var s1 = Symbol.for('id')
var s2 = Symbol.for('id')
var s3 = Symbol.for('abc')
var s5 = Symbol.for('abc')
var s4 = Symbol('abcd')
console.log(Symbol.keyFor(s4))
let object1 = {
    [s1]:'30',
    [s2]:'30',
    [s3]:'30',
    [s5]:'30'
}
console.log(object1)
console.log(Reflect.ownKeys(object1),'object1')